package business;

import java.io.IOException;

import javax.jdo.PersistenceManager;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import jdo.Member;
import util.PMF;

@SuppressWarnings("serial")
public class CreateMemberEntityServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		Member member1 = new Member();
		member1.setUserId("gae1");
		member1.setEmail("gae1@gmail.com");

		Member member2 = new Member();
		member2.setUserId("gae2");
		member2.setEmail("gae2@gmail.com");

		PersistenceManager pm = PMF.createManager();
		try {
			pm.makePersistent(member1);
			pm.makePersistent(member2);
		} finally {
			pm.close();
		}
		resp.setContentType("text/plain");
		resp.getWriter().println("Member is created.");
	}
}
